<template>
  <div>
    <div class="tops">
      <van-nav-bar
        title="消息中心"
        left-text=""
        left-arrow
        style="color: #fff"
        class="bar"
      >
        <template #right>
          <span>排序</span>
          <van-icon name="sort" size="18" />
        </template>
      </van-nav-bar>
    </div>

    <van-tabs v-model="active">
      <van-tab>
        <template #title> 全部消息 <span class="photo"></span></template>
        <div class="tab">
          <div class="bar_tops">
            <div class="bar_tops_box">
              <div class="bar_tops_box_photo">
                <img src="../assets/系统消息.png" alt="" />
                <span class="photo"></span>
              </div>
              <div class="bar_tops_box_photo2">
                <p>系统消息</p>
                <span>发布人:张三</span>
                <span class="photo2"></span>
              </div>
            </div>
            <div class="bar_foot">
              <span>2020-03-10</span>
              <van-icon name="arrow" />
            </div>
          </div>
        </div>
      </van-tab>
      <van-tab title="系统消息" @click="toggle = 1"
        >内容 2 {{ toggle }}</van-tab
      >
      <van-tab title="个人消息" @click="toggle = 2"
        >内容 3 {{ toggle }}</van-tab
      >
    </van-tabs>
  </div>
</template>

<script>
import { getNewCenter } from "@/request/api";

export default {
  data() {
    return {
      active: 0,
      toggle: "",
      newCenterArr: [],
    };
  },
  created() {
    getNewCenter({
      current: 1,
      size: 20,
      type: 0,
    }).then((res) => {
      console.log(res);
    });
  },
  methods: {
    handlebtn() {
      getNewCenter({
        current: 1,
        size: 20,
        type: this.toggle,
      }).then((res) => {
        console.log(res);
      });
    },
  },
};
</script>

<style scoped>
.tab {
  margin-top: 0.5rem;
}
.bar {
  background: blue;
}
.bar_tops {
  height: 80px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
}
.bar_tops_box {
  display: flex;
}
.bar_tops_box_photo{
  width: 30%;
  position: relative;
}
.bar_tops_box_photo img{
  width: 100%;
  /* position: absolute; */
}
.bar_tops_box_photo .photo{
  position: absolute;
  top: 0;
  left: 35px;
}
.bar_foot {
  text-align: center;
}
.photo {
  width: 10px;
  height: 10px;
  background-image: url("../assets/红点.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  display: inline-block;
}
.bar_tops_box_photo2{
  position: relative;
}
.photo2 {
  width: 10px;
  height: 10px;
  background-image: url("../assets/置顶.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  display: inline-block;
  position: absolute;
  top: 4px;
  left: 73px;
}
</style>